﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
using System.Data;

namespace qly
{
    /// <summary>
    /// Interaction logic for LoginWindow.xaml
    /// </summary>
    public partial class LoginWindow : Window
    {
        public LoginWindow()
        {
            InitializeComponent();
        }
        private void Expander_Expanded(object sender, RoutedEventArgs e)
        {
            this.Height = 380;
        }
        private void Expander_Collapsed(object sender, RoutedEventArgs e)
        {
            this.Height = 280;
        }

        private void btDongY_Click(object sender, RoutedEventArgs e)
        {
            Users us = new Users();
            string user = cbTenNguoiDung.Text;
            string pass = pbMatKhau.Password;
            DataTable dt = us.DanhSachUsers(user, pass);
            if (dt.Rows.Count > 0)
            {
                this.Close();
            }
            else
            {
                MessageBox.Show("Tên đăng nhập hoặc mật khẩu không chính xác!", "Cảnh báo", MessageBoxButton.OK, MessageBoxImage.Error);
            }
        }

        private void btThoat_Click(object sender, RoutedEventArgs e)
        {
            this.Close();
        }
    }
}
